package codeblock;

/**
 * @description:
 * @Author yyp
 * @time
 */
public class CodeBlockExercise01 {
    public static void main(String[] args) {
        System.out.println("Exercise01");
        System.out.println("total = "+Person.total);
    }
}

//exercise01
class Person{
    public static int total;
    static {
        total = 1;
        System.out.println("in static block");
    }
}

//exercise02
class Sample{
    Sample(String s){
        System.out.println(s);
    }
    Sample(){
        System.out.println("Sample默认构造函数被调用");
    }
}
class Test{
    Sample sam1 = new Sample("sam1成员初始化");
    static Sample sam = new Sample("");
}

